<template>
	<view class="notice">
		<view class="page-section swiper notice">
			<view class="page-section-spacing notice">
				<swiper class="swiper notice" :autoplay="true" :interval="2000" :duration="500" vertical="true">
					<swiper-item v-for="(item, index) in notice.list" @tap="nav(notice.Info, item)">{{ item.name }}</swiper-item>
				</swiper>
			</view>
		</view>
	</view>
</template>
<script>
export default {
	props: ['notice'],
	data() {
		return {};
	},
	methods: {
		nav(Info, item) {
			let param = '?';
			if (item.key) {
				let keys = Object.keys(item.key);
				keys.forEach(key => {
					param += key + '=' + item.key[key];
					if (keys.indexOf(key) < keys.length - 1) param += '&';
				});
			}
			let url = Info.url;
			url += param;
			if (Info.urlType) {
				uni.switchTab({
					url: url,
					success(e) {
						console.log(e);
					},
					fail(e) {
						console.log(e);
					}
				});
			} else {
				uni.navigateTo({
					url: url,
					success(e) {
						console.log(e);
					},
					fail(e) {
						console.log(e);
					}
				});
			}
		}
	}
};
</script>
<style lang="scss">
.notice {
	background: #ffffff;
	height: 80upx;
	line-height: 80upx;
	border-radius: 20upx;
	margin: 20upx 0;
	padding-left: 10upx;
}
</style>
